home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-in_the_mag-
/
banging_the_metal
/
clocks
/
resclock
/
resclock.doc
< prev
next >
Wrap
Text File
|
1999-11-30
|
4KB
|
86 lines
ResClock -- A software-only replacement for battclock.resource
ResClock was written for my own use, as a do-it-yourself style solution
to a particularly annoying deficiency in my Amiga 1200 -- the lack of a
battery-backed clock. ResClock overrides the system battclock.resource,
providing a software-based equivalent that can keep time over warm reboots.
To use it you only need to run it once after every cold restart. It
installs a tiny (250 bytes) resident module that keeps time independently
and stays active over reboot. After that, you can use your Amiga just as if
it had a real battery-backed clock!
I'd recommend adding either of the snippets below to your S:User-Startup
(or S:Startup-Sequence). They assume ResClock is somewhere along your path,
and take advantage of the fact that ResClock exits with a return code of 5
if it detects that the resident module already exists.
; For those booting straight into Workbench:
ResClock
If warn
SetClock load
Else
Run >Nil: Sys:Prefs/Time
EndIf
; For those booting into a CLI/Shell window
ResClock
If warn
SetClock load
Date
Else
Echo "Enter date & time: " noline
Date >Nil: ?
SetClock save
EndIf
Compared to a real battery-backed clock, ResClock has a few obvious
drawbacks. For example, ResClock will not survive the following:
* Shutting down the Amiga
* Very severe crashes
* Certain games which take over the whole system
* Overzealous viruskillers that think nothing should survive a reset
Disabling interrupts for significant periods will freeze ResClock until
they are enabled again. (The same will happen to the system clock.) This
also means the ResClock will lose a few seconds during each reset, as all
system activity, including interrupts, is halted.
ResClock does not attempt to compensate for this delay, as its length can
be highly variable, depending on things like the time you keep the "three
keys of death" pressed down. Also, ResClock re-activates itself very early
in the boot sequence, even before the bootmenu and any pending alerts are
displayed, which helps keep the delay as short as possible.
Note: ResClock is a hack. There simply is no safe, clean, and elegant
way to replace an existing system resident module, which is exactly what it
does. Also, to keep its size to a minimum, ResClock has no standard library
base structure. Any program that makes too many assumption about
battclock.resource, such as trying to patch it as if it were a library, is
bound to screw ResClock up magnificently.
To replace battclock.resource, ResClock appears under its name in the
resource and resmodules lists. Doing "version battclock.resource" after
ResClock has been active over least one reboot will show a bogus version
number nn.666, where nn is one greater than your kickstart version. If
necessary, the proper way to discover ResClock's presence is to search the
KickMemPtr chain for the name "resclock".
ResClock is hereby placed in the Public Domain. Give it to your friends,
sell it on a CD, reverse engineer it if you wish, it's all up to you.
However, I would consider it common courtesy to include this documentation
if you wish to redistribute it, and to mention my name if you use it in your
own products. It's not as if I get anything else for my efforts.
If you like ResClock, or if you wish to report problems or suggest
improvements, please send e-mail to Ilmari Karonen <iltzu@sci.fi>. The
latest version of ResClock should be available from Aminet or from my web
pages at http://www.sci.fi/~iltzu/